﻿
using CommonType;
using MediatR;
using S_Gridding.Domains.FoundGridding;
using S_Gridding.Infrastructure.Interface.IRead;
using S_Gridding.Read.Api.Application.Commands;
using S_Userinfor.Domains;

namespace S_Gridding.Read.Api.Application.CommandsHanders
{
    public class ResponsUpdCommandsHanders : IRequestHandler<ResponsUpdCommands, Responsibilitygrid>
    {
        private readonly IResponsRepository _respons;

        public ResponsUpdCommandsHanders(IResponsRepository respons)
        {
            _respons = respons;
        }

        public async Task<Responsibilitygrid> Handle(ResponsUpdCommands request, CancellationToken cancellationToken)
        {
            string sql = "SELECT * FROM Responsibilitygrid WHERE Id = @Id";
            return await _respons.GetOne(request.Id, sql);
        }
    }
}
